package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.DbReceiveMapper;
import com.ruoyi.system.domain.DbReceive;
import com.ruoyi.system.service.IDbReceiveService;

/**
 * 优惠券Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-06-08
 */
@Service
public class DbReceiveServiceImpl implements IDbReceiveService 
{
    @Autowired
    private DbReceiveMapper dbReceiveMapper;

    /**
     * 查询优惠券
     * 
     * @param id 优惠券主键
     * @return 优惠券
     */
    @Override
    public DbReceive selectDbReceiveById(Long id)
    {
        return dbReceiveMapper.selectDbReceiveById(id);
    }

    /**
     * 查询优惠券列表
     * 
     * @param dbReceive 优惠券
     * @return 优惠券
     */
    @Override
    public List<DbReceive> selectDbReceiveList(DbReceive dbReceive)
    {
        return dbReceiveMapper.selectDbReceiveList(dbReceive);
    }

    /**
     * 新增优惠券
     * 
     * @param dbReceive 优惠券
     * @return 结果
     */
    @Override
    public int insertDbReceive(DbReceive dbReceive)
    {
        dbReceive.setCreateTime(DateUtils.getNowDate());
        return dbReceiveMapper.insertDbReceive(dbReceive);
    }

    /**
     * 修改优惠券
     * 
     * @param dbReceive 优惠券
     * @return 结果
     */
    @Override
    public int updateDbReceive(DbReceive dbReceive)
    {
        dbReceive.setUpdateTime(DateUtils.getNowDate());
        return dbReceiveMapper.updateDbReceive(dbReceive);
    }

    /**
     * 批量删除优惠券
     * 
     * @param ids 需要删除的优惠券主键
     * @return 结果
     */
    @Override
    public int deleteDbReceiveByIds(Long[] ids)
    {
        return dbReceiveMapper.deleteDbReceiveByIds(ids);
    }

    /**
     * 删除优惠券信息
     * 
     * @param id 优惠券主键
     * @return 结果
     */
    @Override
    public int deleteDbReceiveById(Long id)
    {
        return dbReceiveMapper.deleteDbReceiveById(id);
    }
}
